package com.minivision.dubbodemo.web;

import com.alibaba.dubbo.config.annotation.Reference;
import com.minivision.dubbodemo.city.api.CityDubboService;
import com.minivision.dubbodemo.dto.QueryCityByNameReqVO;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.TimeUnit;

@RestController
public class CityController {
    // dubbo直连 不走zk ,配置url = 127.0.0.1:20555
    @Reference(version = "1.0.0", url = "127.0.0.1:20555")
    private CityDubboService service;

    @PostMapping(value = "/queryCityByName")
    public String queryCityByName(@RequestBody QueryCityByNameReqVO req) {
        return service.queryCityByName(req.getCityName());
    }
}
